package com.ysd.lis.controller.samsto;


import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.lab.LabReqMain;
import com.ysd.lis.entity.samsto.SamstoSpecbox;
import com.ysd.lis.entity.samsto.SamstoSpecboxOrderReq;
import com.ysd.lis.service.samsto.SamstoSpecboxOrderReqService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 仓位-申请表 前端控制器
 * </p>
 *
 * @author WH
 * @since 2024-11-13
 */
@RestController
@RequestMapping("/api/samsto/specboxOrderReq")
public class SamstoSpecboxOrderReqController extends BaseController {

    @Autowired
    private SamstoSpecboxOrderReqService samstoSpecboxOrderReqService;


    @ApiOperation("获取reqMain信息")
    @GetMapping("/getReqData")
    public Result getReqData(LabReqMain labReqMain) {
        return samstoSpecboxOrderReqService.getReqData(labReqMain);
    }

    /**
     * 通过孔位获取历史数据
     *
     * @param samstoSpecboxOrderReq 主键
     * @return 单条数据
     */
    @ApiOperation("通过孔位获取历史数据")
    @GetMapping("/getHisReqNoList")
    public Result getHisReqNoList(SamstoSpecboxOrderReq samstoSpecboxOrderReq) {
        return samstoSpecboxOrderReqService.getHisReqNoList(samstoSpecboxOrderReq);
    }

    /**
     * 通过主键查询单条数据
     *
     * @param specbox 主键
     * @return 单条数据
     */
    @ApiOperation("根据留样盒查询孔位及申请信息")
    @GetMapping("/getSpecboxOrderReqList")
    public Result getSpecboxOrderReqList(SamstoSpecbox specbox) {
        return samstoSpecboxOrderReqService.getSpecboxOrderReqList(specbox);
    }


    /**
     * 新增数据
     *
     * @param samstoSpecboxOrderReqs 实体对象
     * @return 新增结果
     */
    @ApiOperation("添加仓位申请信息")
    @PostMapping("/batchAddOrderReq")
    public Result batchAddOrderReq(@RequestBody List<SamstoSpecboxOrderReq> samstoSpecboxOrderReqs) {
        return samstoSpecboxOrderReqService.batchAddOrderReq(samstoSpecboxOrderReqs);
    }


    /**
     * 销毁
     *
     * @param samstoSpecboxOrderReqs 实体对象
     * @return 新增结果
     */
    @ApiOperation("留样销毁")
    @PostMapping("/batchDistoryReq")
    public Result batchDistoryReq(@RequestBody List<SamstoSpecboxOrderReq> samstoSpecboxOrderReqs) {
        return samstoSpecboxOrderReqService.batchDistoryReq(samstoSpecboxOrderReqs);
    }

    //
    @ApiOperation("标本借出")
    @PostMapping("/sampleLend")
    public Result sampleLend(@RequestBody LabReqMain labReqMain) {
        return samstoSpecboxOrderReqService.sampleLend(labReqMain);
    }

    @ApiOperation("标本归还")
    @PostMapping("/sampleGiveBack")
    public Result sampleGiveBack(@RequestBody LabReqMain labReqMain) {
        return samstoSpecboxOrderReqService.sampleGiveBack(labReqMain);
    }

}
